home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: nntp.coast.net!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: Re: looping & sscanf
- Message-ID: <DLz87p.Aqu@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- References: <DLtqMw.8Ao@emr1.emr.ca> <DLyz1B.DvK@eskimo.com>
- Date: Tue, 30 Jan 1996 04:23:49 GMT
-
- In article <DLyz1B.DvK@eskimo.com> scs@eskimo.com (Steve Summit) writes:
- >In article <DLtqMw.8Ao@emr1.emr.ca>, jagrant@emr1.emr.ca (John Grant) writes:
- >> In FORTRAN, I can read a set of numbers from a character string with an
- >> 'internal read'...
- >> How can I do this easily in C?
- >>...
- >> Perhaps I should loop through the string using strtok(), converting each
- >> substring using atof()?
- >
- >Something like that, yes.
- >
- >> I'm sure it's straightforward, but I just can't see it (or find it in the FAQ).
- >
- >There are some clues in there, which are expanded with an example
- >or two in the book-length version:
- [...]
-
- Thanks Steve. The only clues I found were to use atof() etc &
- sscanf to solve the problems with scanf(). Your quotes from the
- book were helpful. I ended up using strtok/atof, since it seemed
- to have less overhead than makeargv/atof. Of course, I'm not
- considering the overhead of strtok code, whatever that is.
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-